cmake_minimum_required(VERSION 2.6)

set (HOOK_SOURCE_DIR  "${CMAKE_CURRENT_LIST_DIR}")
set (HOOK_OUTPUT_DIR  "${CMAKE_CURRENT_BINARY_DIR}")
set (HOOK_INSTALL_DIR "${PROJECT_SOURCE_DIR}/.git/hooks")

configure_file(
	"${HOOK_SOURCE_DIR}/pre-commit.in"
	"${HOOK_OUTPUT_DIR}/pre-commit"
)

file (
	COPY
		"${HOOK_OUTPUT_DIR}/pre-commit"
	DESTINATION
		"${HOOK_INSTALL_DIR}"
	FILE_PERMISSIONS
		OWNER_EXECUTE OWNER_READ OWNER_WRITE
		GROUP_EXECUTE GROUP_READ GROUP_WRITE
		WORLD_EXECUTE WORLD_READ WORLD_WRITE
)

